package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.api.baidu.BaiduApi;
import com.ybkj.daijia.server.mapper.OrderLocationMapper;
import com.ybkj.daijia.server.model.OrderLocation;
import com.ybkj.daijia.server.model.OrderLocation.OrderType;
import com.ybkj.daijia.server.service.OrderLocationService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DefaultOrderLocationService implements OrderLocationService {

    @Autowired
    private OrderLocationMapper orderLocationMapper;

    @Autowired
    private BaiduApi baiduApi;

    @Transactional(rollbackFor = Exception.class)
    public OrderLocation save(OrderLocation orderLocation) {
        orderLocationMapper.insertRecord(orderLocation);
        return orderLocation;
    }

    @Transactional(rollbackFor = Exception.class)
    public int saveList(List<OrderLocation> list) {
        return orderLocationMapper.insertListRecord(list);
    }

    @Override
    public List<OrderLocation> selectByOrderTypeAndOrderId(OrderType orderType, Long orderId) {
        return orderLocationMapper.selectByOrderTypeAndOrderId(orderType, orderId);
    }

}
